﻿@using PayrollExpress.Helpers;
@using PayrollExpress.Models;
@model HolidaysAddModel

@Html.Partial("_BreadCrumb", Model.BreadCrumb)

@using (Html.BeginForm(BaseHelper.PageAddEditSave.HolidaysSave.ToString(), Model.ControllerName, FormMethod.Post, new { id = "saveForm" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-9">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h2>@Model.Year @BaseHelper.Page.Holidays.ToDescription()</h2>
                        </div>
                        <div class="ibox-title">
                            <h3>@MasterfileHelper.ListTitles.RecurringHolidays.ToDescription()</h3>
                        </div>
                        <div class="ibox-content">
                            <table class="table table-striped table-bordered table-hover">
                                <thead class="header">
                                    <tr>
                                        <th>@AdministrationHelper.ListHeaders.Date.ToDescription()</th>
                                        <th>@AdministrationHelper.ListHeaders.Description.ToDescription()</th>
                                        <th>@AdministrationHelper.ListHeaders.HolidayTypeName.ToDescription()</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @for (var i = 0; i < Model.NewRecurringHolidays.Count(); i++)
                                    {
                                    <tr>
                                        <td>
                                            <div class="row">
                                                <div class="col-lg-4">
                                                    @if (Model.NewRecurringHolidays[i].Month > 0)
                                                        {
                                                            <span class="single-line">@(((AdministrationHelper.CalendarMonth)Model.NewRecurringHolidays[i].Month).ToDescription())</span>
                                                            @Html.HiddenFor(m => m.NewRecurringHolidays[i].Month)
                                                            
                                                        }
                                                        else
                                                        {
                                                            @Html.DropDownListFor(m => Model.NewRecurringHolidays[i].Month, Model.CalendarMonths, new { @class = "form-control input" })
                                                        }
                                                </div>
                                                <div class="col-lg-4">
                                                    @if (Model.NewRecurringHolidays[i].Month > 0)
                                                        {
                                                            <span class="single-line">@Html.ValueFor(m => Model.NewRecurringHolidays[i].Day, "{0:00}")</span>
                                                            @Html.HiddenFor(m => m.NewRecurringHolidays[i].Day)
                                                        }
                                                        else
                                                        {
                                                            @Html.DropDownListFor(m => Model.NewRecurringHolidays[i].Day, Model.CalendarDays, new { @class = "form-control input" })
                                                        }
                                                </div>
                                                <div class="col-lg-4">
                                                    <span class="single-line">@Html.DisplayFor(m => Model.NewRecurringHolidays[i].Year)</span>
                                                    @Html.HiddenFor(m => m.NewRecurringHolidays[i].Year)
                                                </div>
                                            </div>
                                        </td>
                                        <td>
                                            @Html.DisplayFor(m => m.NewRecurringHolidays[i].Description)
                                            @Html.HiddenFor(m => m.NewRecurringHolidays[i].Description)
                                            @Html.HiddenFor(m => m.NewRecurringHolidays[i].ID)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(m => m.NewRecurringHolidays[i].HolidayTypeName)
                                            @Html.HiddenFor(m => m.NewRecurringHolidays[i].HolidayTypeID)
                                        </td>
                                    </tr>
                                    }
                                </tbody>
                            </table>
                        </div>
                        <div class="ibox-title">
                            <h3>@MasterfileHelper.ListTitles.NewHolidays.ToDescription()</h3>
                        </div>
                        <div class="ibox-content">
                            <table class="table table-striped table-bordered table-hover">
                                <thead class="header">
                                    <tr>
                                        <th>@AdministrationHelper.ListHeaders.Date.ToDescription()</th>
                                        <th>@AdministrationHelper.ListHeaders.Description.ToDescription()</th>
                                        <th>@AdministrationHelper.ListHeaders.HolidayTypeName.ToDescription()</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @for (var i = 0; i < Model.NewHolidays.Count(); i++)
                                    {
                                    <tr>
                                        <td>
                                            <div class="row">
                                                <div class="col-lg-4">
                                                    @Html.DropDownListFor(m => Model.NewHolidays[i].Month, Model.CalendarMonths, new { @class = "form-control input" })
                                                </div>
                                                <div class="col-lg-4">
                                                    @Html.DropDownListFor(m => Model.NewHolidays[i].Day, Model.CalendarDays, new { @class = "form-control input" })
                                                </div>
                                                <div class="col-lg-4">
                                                    <span class="single-line">@Html.DisplayFor(m => Model.NewHolidays[i].Year)</span>
                                                    @Html.HiddenFor(m => m.NewHolidays[i].Year)
                                                </div>
                                            </div>
                                        </td>
                                        <td>@Html.EditorFor(m => m.NewHolidays[i].Description)</td>
                                        <td>@Html.DropDownListFor(m => m.NewHolidays[i].HolidayTypeID, Model.HolidayTypes, new { @class = "form-control input" })</td>
                                    </tr>
                                    }
                                </tbody>
                            </table>
                            <p></p>
                            <button type="submit" id="btnSave" class="btn btn-primary" name="command" value=@Model.PageAction>@BaseHelper.PageAction.Save.ToDescription()</button>
                            <button type="submit" id="btnCancel" class="btn btn-primary cancel" name="command" value="@BaseHelper.PageAction.Cancel.ToString()">@BaseHelper.PageAction.Cancel.ToDescription()</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </fieldset>
}

@section Styles {
    @Styles.Render("~/Content/plugins/dataTables/dataTablesStyles")
}

@section Scripts {
    @Scripts.Render("~/plugins/dataTables")

    <script type="text/javascript">
        $(document).ready(function () {

        });
    </script>
}
